using System;
using System.Collections.Generic;

namespace B.S.XZYData.Api.Read.Dto.WorkOrder
{
    /// <summary>
    /// 工单列表DTO
    /// </summary>
    public class WorkOrderDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 来源计划明细ID
        /// </summary>
        public int? PlanItemId { get; set; }

        /// <summary>
        /// 工艺路线ID
        /// </summary>
        public int? RouteId { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string? ProductCode { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string? ProductName { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string? Spec { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 计划数量
        /// </summary>
        public int? PlannedQuantity { get; set; }

        /// <summary>
        /// 实际数量
        /// </summary>
        public int? ActualQuantity { get; set; }

        /// <summary>
        /// 良品数量
        /// </summary>
        public int? GoodQuantity { get; set; }

        /// <summary>
        /// 不良品数量
        /// </summary>
        public int? BadQuantity { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string? Status { get; set; }

        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime? PlannedStartTime { get; set; }

        /// <summary>
        /// 计划结束时间
        /// </summary>
        public DateTime? PlannedEndTime { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际结束时间
        /// </summary>
        public DateTime? ActualEndTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? CreateBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string? UpdateBy { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 工序数量统计
        /// </summary>
        public int ProcessCount { get; set; }
    }

    /// <summary>
    /// 工单详情DTO（包含工序列表）
    /// </summary>
    public class WorkOrderDetailDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 来源计划明细ID
        /// </summary>
        public int? PlanItemId { get; set; }

        /// <summary>
        /// 工艺路线ID
        /// </summary>
        public int? RouteId { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string? ProductCode { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string? ProductName { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string? Spec { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 计划数量
        /// </summary>
        public int? PlannedQuantity { get; set; }

        /// <summary>
        /// 实际数量
        /// </summary>
        public int? ActualQuantity { get; set; }

        /// <summary>
        /// 良品数量
        /// </summary>
        public int? GoodQuantity { get; set; }

        /// <summary>
        /// 不良品数量
        /// </summary>
        public int? BadQuantity { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string? Status { get; set; }

        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime? PlannedStartTime { get; set; }

        /// <summary>
        /// 计划结束时间
        /// </summary>
        public DateTime? PlannedEndTime { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际结束时间
        /// </summary>
        public DateTime? ActualEndTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? CreateBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string? UpdateBy { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 工单工序列表
        /// </summary>
        public List<WorkOrderProcessDto> Processes { get; set; } = new List<WorkOrderProcessDto>();
    }

    /// <summary>
    /// 工单工序DTO
    /// </summary>
    public class WorkOrderProcessDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 所属工单ID
        /// </summary>
        public int WorkOrderId { get; set; }

        /// <summary>
        /// 顺序号
        /// </summary>
        public int Sequence { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string ProcessCode { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcessName { get; set; }

        /// <summary>
        /// 计划数量
        /// </summary>
        public int? PlannedQuantity { get; set; }

        /// <summary>
        /// 已报工数
        /// </summary>
        public int? ReportedQuantity { get; set; }

        /// <summary>
        /// 良品数
        /// </summary>
        public int? GoodQuantity { get; set; }

        /// <summary>
        /// 不良品数
        /// </summary>
        public int? BadQuantity { get; set; }

        /// <summary>
        /// 报工配比
        /// </summary>
        public decimal? Ratio { get; set; }

        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime? PlannedStartTime { get; set; }

        /// <summary>
        /// 计划结束时间
        /// </summary>
        public DateTime? PlannedEndTime { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际结束时间
        /// </summary>
        public DateTime? ActualEndTime { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string? Status { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 工序分派列表
        /// </summary>
        public List<WorkOrderAssignDto> Assigns { get; set; } = new List<WorkOrderAssignDto>();
    }

    /// <summary>
    /// 工序分派DTO
    /// </summary>
    public class WorkOrderAssignDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 工单工序ID
        /// </summary>
        public int WorkOrderProcessId { get; set; }

        /// <summary>
        /// 员工ID
        /// </summary>
        public int EmployeeId { get; set; }

        /// <summary>
        /// 员工姓名
        /// </summary>
        public string EmployeeName { get; set; }

        /// <summary>
        /// 分派数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
    }

    /// <summary>
    /// 工序选择DTO（用于添加工单时选择工序）
    /// </summary>
    public class RouteStepSelectDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 所属路线ID
        /// </summary>
        public int RouteId { get; set; }

        /// <summary>
        /// 顺序号
        /// </summary>
        public int Sequence { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string ProcessCode { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcessName { get; set; }

        /// <summary>
        /// 报工配比
        /// </summary>
        public decimal? Ratio { get; set; }

        /// <summary>
        /// 工序类型
        /// </summary>
        public string? Type { get; set; }

        /// <summary>
        /// 不良品序列
        /// </summary>
        public string? DefectSequence { get; set; }
    }
}
